home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 3 / CD_Magazyn_EXEC_nr_3.iso / Gry / Mahjongg Tiles.lha / MahjonggTilesInstall / Install next >
Text File  |  2000-08-06  |  9KB  |  363 lines

  1. ; $VER: Installation script for MahjonggTiles 1.0 ( 1. August 2000)
  2. ; © Geoffrey Whaite
  3. ; Created with GoldED 5.0
  4.  
  5. ; check if we are running under correct OS
  6.  
  7. (if (< (/ (getversion) 65536) 39)
  8.  
  9.     (
  10.         (abort "Incorrect OS version (software requires OS 39 or better )!")
  11.     )
  12. )
  13.  
  14. ; error handling
  15.  
  16. (onerror
  17.  
  18.     (if (> @ioerr 0)
  19.  
  20.         (
  21.             (message
  22.  
  23.                 ("An error has occurred during installation. Please check the log file to understand the error.")
  24.             )
  25.         )
  26.     )
  27.  
  28.     (exit (quiet))
  29. )
  30.  
  31. (welcome)
  32.  
  33. (set @default-dest
  34.  
  35.     (askdir
  36.  
  37.         (prompt "Please choose the installation path. A new drawer named 'MahjonggTiles' will be created here.")
  38.  
  39.         (help "Installation creates a new drawer for MahjonggTiles in the path you specify.")
  40.  
  41.         (default @default-dest)
  42.     )
  43. )
  44.  
  45. ; --- insert your code below ---
  46.  
  47. ;
  48. ;   define procedure to copy a file only if the file does not exist in
  49. ;   the destination directory
  50. ;
  51. (procedure P_CopyNotExist #srcDir_CNE #destDir_CNE #fileName_CNE
  52.     (if (not (exists (tackon #destDir_CNE #fileName_CNE)))
  53.         (copyfiles
  54.             (source (tackon #srcDir_CNE #fileName_CNE))
  55.             (dest #destDir_CNE)
  56.         )
  57.     )
  58. )
  59.  
  60. ;
  61. ;   define a procedure to copy all the files matching a pattern in a source
  62. ;   directory to a destination directory only if the file does not already
  63. ;   exist in the destination directory
  64. ;
  65. (procedure P_DirCopyNotExist #srcDir_DCNE #destDir_DCNE #pattern_DCNE
  66.  
  67.     (
  68.         (makedir #destDir_DCNE)
  69.  
  70.         (foreach #srcDir_DCNE #pattern_DCNE
  71.             (if (< @each-type 0)
  72.                 (P_CopyNotExist #srcDir_DCNE #destDir_DCNE @each-name)
  73.             )
  74.         )
  75.     )
  76. )
  77.  
  78. ;
  79. ;   define a procedure to copy all the files matching a pattern in a
  80. ;   source directory to a destination directory using the 'copylib'
  81. ;   function for version checking
  82. ;
  83. (procedure P_DirCopyLib #srcDir_DCL #destDir_DCL #pattern_DCL
  84.  
  85.     (foreach #srcDir_DCL #pattern_DCL
  86.         (if (< @each-type 0)
  87.             (copylib
  88.                 (source (tackon #srcDir_DCL @each-name))
  89.                 (dest #destDir_DCL)
  90.                 (infos)
  91.             )
  92.         )
  93.     )
  94. )
  95.  
  96. ;
  97. ;   define a procedure to copy a documentation file directory for a
  98. ;   given language, uses 'copylib' for version checking while copying
  99. ;
  100. (procedure P_CopyDocDir #lang_CDD
  101.     (
  102.         (set #srcDir_CDD  (tackon "docs"   #lang_CDD))
  103.         (set #destDir_CDD (tackon #doc-dir #lang_CDD))
  104.  
  105.         (makedir #destDir_CDD (infos))
  106.         (P_DirCopyLib #srcDir_CDD #destDir_CDD "#?")
  107.     )
  108. )
  109.  
  110. ;
  111. ;   define a procedure to copy a set of tilesets related by name, it is
  112. ;   assumed that the tilesets are organized as one or more tileset descriptor
  113. ;   files of the form <name>#?.tiles with the image files in a sub-directory
  114. ;   named <name>, where <name> is the given name for the set of tilesets, the
  115. ;   tileset files are copied only if they do not already exist
  116. ;
  117. (procedure P_CopyTileSets #name_CTS
  118.     (
  119.         (P_DirCopyNotExist "tiles" #tiles-dir (cat #name_CTS "#?.tiles"))
  120.         (P_DirCopyNotExist
  121.             (tackon "tiles"    #name_CTS)
  122.             (tackon #tiles-dir #name_CTS)
  123.             "#?"
  124.         )
  125.     )
  126. )
  127.  
  128. ;
  129. ;   set some variables
  130. ;
  131. (set #mahjonggTiles-dir (tackon @default-dest "MahjonggTiles"))
  132.  
  133. (set #source-dir "MahjonggTiles")
  134. (set #images-dir (tackon #mahjonggTiles-dir "images"))
  135. (set #tiles-dir (tackon #mahjonggTiles-dir "tiles"))
  136. (set #layouts-dir (tackon #mahjonggTiles-dir "layouts"))
  137. (set #doc-dir (tackon #mahjonggTiles-dir "docs"))
  138. (set #cat-dir (tackon #mahjonggTiles-dir "catalogs"))
  139.  
  140. (set #copylib-confirm-fmt "Copying file '%s'")
  141.  
  142. (set #installing-shared "Installing shared libraries ...")
  143. (set #creating-dirs "Creating directories ...")
  144. (set #installing-bin "Installing executable files ...")
  145. (set #installing-cats "Installing language catalog files ...")
  146. (set #installing-docs "Installing documentation files ...")
  147. (set #installing-images "Installing GUI image files ...")
  148. (set #installing-layouts "Installing layouts ...")
  149. (set #installing-tilesets "Installing tilesets ...")
  150.  
  151. (set #tiles-default-name "Default Tilesets (three tilesets)")
  152. (set #tiles-hongkong-name "Hong Kong Tilesets (two tilesets)")
  153. (set #tiles-taipei-name "Taipei Tileset")
  154. (set #tiles-gnome-name "Gnome Tileset")
  155. (set #tiles-kme-name "KME Tileset")
  156. (set #tiles-arch-name "Archaeological Icons Tileset")
  157. (set #tiles-smiley-name "Smiley Tileset")
  158.  
  159. (set #tileset-opts-prompt "Select which optional tilesets to install.")
  160. (set #tileset-opts-help
  161.     (cat
  162.         "Check the optional tilesets you wish to install.\n\n"
  163.         "The following optional tilesets are available :-\n\n"
  164.         #tiles-hongkong-name " -\n"
  165.         "    from the OS/2 game 'Mahjongg Solitaire'.\n\n"
  166.         #tiles-taipei-name " -\n"
  167.         "    from the Windoze game 'Taipei'.\n\n"
  168.         #tiles-taipei-name " -\n"
  169.         "    from the Linux/Gnome Mahjongg game.\n\n"
  170.         #tiles-kme-name " -\n"
  171.         "    from the Linux/KME Mahjongg game.\n\n"
  172.         #tiles-arch-name " -\n"
  173.         "    derived from Lyle Zapato's Archaeological Icons.\n\n"
  174.         #tiles-smiley-name " -\n"
  175.         "    smiley face tileset by Richard Kapp.\n"
  176.     )
  177. )
  178.  
  179. ;
  180. ;   currently there is only english documentation and no additional language
  181. ;   catalogs
  182. ;
  183. (set #doc-opts $FFFFFFFF)
  184. (set #cat-opts $FFFFFFFF)
  185.  
  186. ;
  187. ;   decide which optional tilesets to install, the default is to install all
  188. ;   but if the user level is expert then ask which tilesets to install
  189. ;
  190. (set #tileset-opts $3F)
  191. (if (= @user-level 2 )
  192.     (set
  193.         #tileset-opts
  194.         (askoptions
  195.             (prompt #tileset-opts-prompt)
  196.             (help #tileset-opts-help)
  197.             (default #tileset-opts)
  198.             (choices
  199.                 #tiles-hongkong-name
  200.                 #tiles-taipei-name
  201.                 #tiles-gnome-name
  202.                 #tiles-kme-name
  203.                 #tiles-arch-name
  204.                 #tiles-smiley-name
  205.             )
  206.         )
  207.     )
  208. )
  209.  
  210. ;
  211. ;   start copying
  212. ;
  213. (complete 0)
  214.  
  215. ;
  216. ;   copy shared libraries
  217. ;
  218. (working #installing-shared)
  219. (P_DirCopyLib "libs" "LIBS:" "#?")
  220. (complete 1)
  221.  
  222. ;
  223. ;   create the MahjonggTiles directory structure
  224. ;
  225. (working #creating-dirs)
  226. (makedir #mahjonggTiles-dir)
  227. ;(copyfiles (source "MahjonggTiles") (dest #mahjonggTiles-dir) (all) (infos))
  228. (if (not (exists (tackon @default-dest "MahjonggTiles.info")))
  229.     (copyfiles
  230.         (source "icons/MahjonggTiles_Drawer.info")
  231.         (dest @default-dest)
  232.         (newname "MahjonggTiles.info")
  233.     )
  234. )
  235. (makedir (tackon #mahjonggTiles-dir "settings"))
  236. (makedir #doc-dir (infos))
  237. (makedir #cat-dir)
  238. (makedir #images-dir)
  239. (makedir #layouts-dir)
  240. (makedir #tiles-dir)
  241. (complete 2)
  242.  
  243. ;
  244. ;   install the binaries
  245. ;
  246. (working #installing-bin)
  247. (P_DirCopyLib "bin" #mahjonggTiles-dir "#?")
  248. (complete 26)
  249.  
  250. ;
  251. ;   install the language catalog files, first we install the '.cd' files
  252. ;   then install any requested language catalogs (currently there are none)
  253. ;
  254. (working #installing-cats)
  255. (P_DirCopyLib "catalogs" #cat-dir "#?.cd")
  256. (complete 32)
  257.  
  258. ;
  259. ;   copy the GUI image files, only copy those files that do not exist in
  260. ;   the destination as these files are unlikely to change so there is no
  261. ;   need to copy them if they already exist
  262. ;
  263. (working #installing-images)
  264. (P_DirCopyNotExist "images" #images-dir "#?")
  265. (complete 33)
  266.  
  267. ;
  268. ;   copy the documentation files for the requested languages, currently
  269. ;   there is only english documentation
  270. ;
  271. (working #installing-docs)
  272. (if (<> 0 (BITAND #doc-opts $01))
  273.  
  274.     (P_CopyDocDir "english")
  275. )
  276. (complete 42)
  277.  
  278. ;
  279. ;   copy the layouts, only copy those layouts that do not exist already as
  280. ;   layout files also contain best time data that we would not want to
  281. ;   overwrite
  282. ;
  283. (working #installing-layouts)
  284. (P_DirCopyNotExist "layouts" #layouts-dir "#?.layout")
  285. (complete 44)
  286.  
  287. ;
  288. ;   copy the tilesets, only copy those files that do not exist as the
  289. ;   image files can be large and are unlikely to change so not copying
  290. ;   existing files can be much quicker when installing an update
  291. ;
  292. (working #installing-tilesets)
  293. ;
  294. ;   copy tileset backgrounds
  295. ;
  296. (P_DirCopyNotExist "tiles/backgrounds" (tackon #tiles-dir "backgrounds") "#?")
  297. (complete 63)
  298.  
  299. ;
  300. ;   copy the default tilesets
  301. ;
  302. (P_CopyTileSets "Default")
  303. (complete 72)
  304.  
  305. ;
  306. ;   install the Hong Kong tilesets if selected for installation
  307. ;
  308. (if (<> 0 (BITAND #tileset-opts $01))
  309.  
  310.     (P_CopyTileSets "HongKong")
  311. )
  312. (complete 79)
  313.  
  314. ;
  315. ;   install the Taipei tileset if selected for installation
  316. ;
  317. (if (<> 0 (BITAND #tileset-opts $02))
  318.  
  319.     (P_CopyTileSets "Taipei")
  320. )
  321. (complete 82)
  322.  
  323. ;
  324. ;   install the Gnome tileset if selected for installation
  325. ;
  326. (if (<> 0 (BITAND #tileset-opts $04))
  327.  
  328.     (P_CopyTileSets "Gnome")
  329. )
  330. (complete 84)
  331.  
  332. ;
  333. ;   install the KME tileset if selected for installation
  334. ;
  335. (if (<> 0 (BITAND #tileset-opts $08))
  336.  
  337.     (P_CopyTileSets "kme")
  338. )
  339. (complete 87)
  340.  
  341. ;
  342. ;   install the Archaeological tileset if selected for installation
  343. ;
  344. (if (<> 0 (BITAND #tileset-opts $10))
  345.  
  346.     (P_CopyTileSets "Archaeological")
  347. )
  348. (complete 92)
  349.  
  350. ;
  351. ;   install the Smiley tileset if selected for installation
  352. ;
  353. (if (<> 0 (BITAND #tileset-opts $20))
  354.  
  355.     (P_CopyTileSets "Smiley")
  356. )
  357. (complete 100)
  358.  
  359. ; --- end of your code ---
  360.  
  361. (exit)
  362.  
  363.